import ModalFactory from "./factory.js";
console.log("factory");


(() => {
  const oModal = document.getElementsByClassName("modal")[0];
  const oBtns = document.getElementsByClassName("btns")[0];
  const modalFactory = new ModalFactory(oModal);
  const init = () => {
    bindEvent();
  };
  init();
  function bindEvent() {
    oBtns.addEventListener("click", handleBtnClick, false);
  }
  function handleBtnClick(e) {
    const tar = e.target;
    const tagName = tar.tagName.toLowerCase();
    if (tagName === "button") {
      const status = tar.dataset.status;
      modalFactory.create('Factory-Modal',status);
    }
  }
})();
